/**
* Copyright (c) 2016-2100 yunclouds
*/
package com.yunqian.web;

import com.yunqian.redot.constant.BusinessType;
import com.yunqian.redot.domain.Banner;
import com.yunqian.redot.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * Describe: 轮播图管理信息控制器
 *
 * @author zsy
 * 2018-09-29 16:01:12
 */
 @RestController
 @RequestMapping("/api/banner")
public class BannerController {

     @Autowired
     private BannerService bannerService;

     /**
     * 咨讯轮播图
     *
     * @return
     */
    @GetMapping("/information/all")
    public Map<String, Object> information() {
        List<Banner> bannerList = bannerService.getAllByLinkType(BusinessType.INFORMATION.getCode());
        Map<String, Object> map = new HashMap<>(16);
        map.put("bannerList", bannerList);
        return map;
    }

    /**
     * 课程轮播图
     * @return
     */
    @GetMapping("/courses/all")
    public Map<String, Object> courses() {
        List<Banner> bannerList = bannerService.getAllByLinkType(BusinessType.COURSES.getCode());
        Map<String, Object> map = new HashMap<>(16);
        map.put("bannerList", bannerList);
        return map;
    }

    /**
     * 所有轮播图
     * @return
     */
    @GetMapping("/all")
    public Map<String, Object> list() {
        List<Banner> bannerList = bannerService.findAll();
        Map<String, Object> map = new HashMap<>(16);
        map.put("bannerList", bannerList);
        return map;
    }

}
